<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <title>添加信息</title>
    <div th:replace="common/link::header"></div>
</head>
<body>
<div class="layui-fluid">
    <div class="layui-card">
        <div class="layui-card-header">基本信息</div>
        <div class="layui-card-body">
            <div class="layui-row">
                <div class="layui-form layui-form-pane" lay-filter="ad_form" id="ad_form">
                    <input type="hidden" name="id" id="id">
                    <div class="layui-form-item">
                        <label class="layui-form-label">图片</label>
                        <div style="width: 1000px">
                            <div class="layui-upload">
                                <input type="hidden" id="picture" name="picture">
                                <div class="layui-upload-list" id="img_upload">
                                    <img style="width: 100px;height: 100px;padding: 5px;float: left;"
                                         onclick="fun.preview(this)" id="upload-img0"
                                         hidden="true">
                                    <img style="width: 100px;height: 100px;padding: 5px;float: left;"
                                         onclick="fun.preview(this)" id="upload-img1"
                                         hidden="true">
                                    <img style="width: 100px;height: 100px;padding: 5px;float: left;"
                                         onclick="fun.preview(this)" id="upload-img2"
                                         hidden="true">
                                    <img style="width: 100px;height: 100px;padding: 5px;float: left;"
                                         onclick="fun.preview(this)" id="upload-img3"
                                         hidden="true">
                                    <img style="width: 100px;height: 100px;padding: 5px;float: left;"
                                         onclick="fun.preview(this)" id="upload-img4"
                                         hidden="true">
                                    <img style="width: 100px;height: 100px;padding: 5px;float: left;"
                                         onclick="fun.preview(this)" id="upload-img5"
                                         hidden="true">
                                    <img style="width: 100px;height: 100px;padding: 5px;float: left;"
                                         onclick="fun.preview(this)" id="upload-img6"
                                         hidden="true">
                                    <img style="width: 100px;height: 100px;padding: 5px;float: left;"
                                         onclick="fun.preview(this)" id="upload-img7"
                                         hidden="true">
                                    <img style="width: 100px;height: 100px;padding: 5px;float: left;"
                                         onclick="fun.preview(this)" id="upload-img8"
                                         hidden="true">
                                    <img style="width: 100px;height: 100px;padding: 5px;float: left;"
                                         onclick="fun.preview(this)" id="upload-img9"
                                         hidden="true">
                                    <img style="width: 100px;height: 100px;padding: 5px;float: left;"
                                         onclick="fun.preview(this)" id="upload-img10"
                                         hidden="true">
                                    <img style="width: 100px;height: 100px;padding: 5px;float: left;"
                                         onclick="fun.preview(this)" id="upload-img11"
                                         hidden="true">
                                    <img style="width: 100px;height: 100px;padding: 5px;float: left;"
                                         onclick="fun.preview(this)" id="upload-img12"
                                         hidden="true">
                                    <img style="width: 100px;height: 100px;padding: 5px;float: left;"
                                         onclick="fun.preview(this)" id="upload-img13"
                                         hidden="true">
                                    <img style="width: 100px;height: 100px;padding: 5px;float: left;"
                                         onclick="fun.preview(this)" id="upload-img14"
                                         hidden="true">
                                    <img style="width: 100px;height: 100px;padding: 5px;float: left;"
                                         onclick="fun.preview(this)" id="upload-img15"
                                         hidden="true">
                                    <img style="width: 100px;height: 100px;padding: 5px;float: left;"
                                         onclick="fun.preview(this)" id="upload-img16"
                                         hidden="true">
                                    <img style="width: 100px;height: 100px;padding: 5px;float: left;"
                                         onclick="fun.preview(this)" id="upload-img17"
                                         hidden="true">
                                    <img style="width: 100px;height: 100px;padding: 5px;float: left;"
                                         onclick="fun.preview(this)" id="upload-img18"
                                         hidden="true">
                                    <img style="width: 100px;height: 100px;padding: 5px;float: left;"
                                         onclick="fun.preview(this)" id="upload-img19"
                                         hidden="true">
                                    <img style="width: 100px;height: 100px;padding: 5px;float: left;"
                                         onclick="fun.preview(this)" id="upload-img20"
                                         hidden="true">
                                    <img style="width: 100px;height: 100px;padding: 5px;float: left;"
                                         onclick="fun.preview(this)" id="upload-img21"
                                         hidden="true">
                                    <img style="width: 100px;height: 100px;padding: 5px;float: left;"
                                         onclick="fun.preview(this)" id="upload-img22"
                                         hidden="true">
                                    <img style="width: 100px;height: 100px;padding: 5px;float: left;"
                                         onclick="fun.preview(this)" id="upload-img23"
                                         hidden="true">
                                    <img style="width: 100px;height: 100px;padding: 5px;float: left;"
                                         onclick="fun.preview(this)" id="upload-img24"
                                         hidden="true">
                                    <p id="upload-img-text"></p>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="layui-form-item" style="text-align: center">
                        <div class="layui-btn-group">
                            <button type="button" class="layui-btn layui-btn-primary" id="upload-img-btn">上传
                            </button>
                            <button type="button" class="layui-btn layui-btn-primary" id="clear-img-btn">清除
                            </button>
                        </div>
                    </div>
                    <!--第一个-->
                    <div class="layui-form-item">
                        <label class="layui-form-label" style="width: 180px">线路编号</label>
                        <div class="layui-input-inline">
                            <input type="text" lay-verify="required" class="layui-input" name="lineNo"
                                   placeholder="请输入线路编号"/>
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label class="layui-form-label" style="width: 180px">线路名称</label>
                        <div class="layui-input-inline">
                            <input type="text" lay-verify="required" class="layui-input" name="lineName"
                                   placeholder="请输入线路名称"/>
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label class="layui-form-label" style="width: 180px">机器序列号</label>
                        <div class="layui-input-inline">
                            <input type="text" lay-verify="required" class="layui-input" name="sNumber"
                                   placeholder="请输入机器序列号,公共信息请输入common"/>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label" style="width: 180px">门翼编码</label>
                        <div class="layui-input-inline">
                            <input type="text" class="layui-input" name="GPartNumber"
                                   placeholder="请输入门翼编码"/>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label" style="width: 180px">门翼名称</label>
                        <div class="layui-input-inline">
                            <input type="text" class="layui-input" name="GPartName" placeholder="请输入门翼名称"/>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label" style="width: 180px">读写器编码</label>
                        <div class="layui-input-inline">
                            <input type="text" class="layui-input" name="RPartNumber"
                                   placeholder="请输入读写器编码"/>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label" style="width: 180px">读写器名称</label>
                        <div class="layui-input-inline">
                            <input type="text" class="layui-input" name="RPartName" placeholder="请输入读写器名称"/>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label" style="width: 180px">磁模块编码</label>
                        <div class="layui-input-inline">
                            <input type="text" class="layui-input" name="MPartNumber"
                                   placeholder="请输入磁模块编码"/>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label" style="width: 180px">磁模块名称</label>
                        <div class="layui-input-inline">
                            <input type="text" class="layui-input" name="MPartName" placeholder="请输入磁模块名称"/>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label" style="width: 180px">显示屏编码</label>
                        <div class="layui-input-inline">
                            <input type="text" class="layui-input" name="DPartNumber"
                                   placeholder="请输入显示屏编码"/>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label" style="width: 180px">显示屏名称</label>
                        <div class="layui-input-inline">
                            <input type="text" class="layui-input" name="DPartName" placeholder="请输入显示屏名称"/>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label" style="width: 180px">通行控制单元编码</label>
                        <div class="layui-input-inline">
                            <input type="text" class="layui-input" name="CPartNumber"
                                   placeholder="请输入通行控制单元编码"/>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label" style="width: 180px">通行控制单元名称</label>
                        <div class="layui-input-inline">
                            <input type="text" class="layui-input" name="CPartName" placeholder="请输入通行控制单元名称"/>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label" style="width: 180px">备用电源编码</label>
                        <div class="layui-input-inline">
                            <input type="text" class="layui-input" name="EPartNumber"
                                   placeholder="请输入备用电源编码"/>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label" style="width: 180px">备用电源名称</label>
                        <div class="layui-input-inline">
                            <input type="text" class="layui-input" name="EPartName" placeholder="请输入备用电源名称"/>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label" style="width: 180px">数据存储卡编码</label>
                        <div class="layui-input-inline">
                            <input type="text" class="layui-input" name="SPartNumber"
                                   placeholder="请输入数据存储卡编码"/>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label" style="width: 180px">数据存储卡名称</label>
                        <div class="layui-input-inline">
                            <input type="text" class="layui-input" name="SPartName" placeholder="请输入数据存储卡名称"/>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label" style="width: 180px">编码器编码</label>
                        <div class="layui-input-inline">
                            <input type="text" class="layui-input" name="CoPartNumber"
                                   placeholder="请输入编码器编码"/>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label" style="width: 180px">编码器名称</label>
                        <div class="layui-input-inline">
                            <input type="text" class="layui-input" name="CoPartName"
                                   placeholder="请输入编码器名称"/>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label" style="width: 180px">工控机编码</label>
                        <div class="layui-input-inline">
                            <input type="text" class="layui-input" name="IpcPartNumber"
                                   placeholder="请输入工控机编码"/>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label" style="width: 180px">工控机名称</label>
                        <div class="layui-input-inline">
                            <input type="text" class="layui-input" name="IpcPartName"
                                   placeholder="请输入工控机名称"/>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label" style="width: 180px">二维码识读模块编码</label>
                        <div class="layui-input-inline">
                            <input type="text" class="layui-input" name="QrPartNumber"
                                   placeholder="请输入二维码识读模块编码"/>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label" style="width: 180px">二维码识读模块名称</label>
                        <div class="layui-input-inline">
                            <input type="text" class="layui-input" name="QrPartName"
                                   placeholder="请输入二维码识读模块名称"/>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label" style="width: 180px">人脸图像采集模块编码</label>
                        <div class="layui-input-inline">
                            <input type="text" class="layui-input" name="FPartNumber"
                                   placeholder="请输入人脸图像采集模块编码"/>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label" style="width: 180px">人脸图像采集模块名称</label>
                        <div class="layui-input-inline">
                            <input type="text" class="layui-input" name="FPartName" placeholder="请输入人脸图像采集模块名称"/>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label" style="width: 180px">旅行证件识读模块编码</label>
                        <div class="layui-input-inline">
                            <input type="text" class="layui-input" name="TPartNumber"
                                   placeholder="请输入旅行证件识读模块编码"/>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label" style="width: 180px">旅行证件识读模块名称</label>
                        <div class="layui-input-inline">
                            <input type="text" class="layui-input" name="TPartName" placeholder="请输入旅行证件识读模块名称"/>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label" style="width: 180px">电机驱动器编码</label>
                        <div class="layui-input-inline">
                            <input type="text" class="layui-input" name="MdPartNumber"
                                   placeholder="请输入电机驱动器编码"/>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label" style="width: 180px">电机驱动器名称</label>
                        <div class="layui-input-inline">
                            <input type="text" class="layui-input" name="MdPartName"
                                   placeholder="请输入电机驱动器名称"/>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label" style="width: 180px">测量光幕编码</label>
                        <div class="layui-input-inline">
                            <input type="text" class="layui-input" name="MlPartNumber"
                                   placeholder="请输入测量光幕编码"/>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label" style="width: 180px">测量光幕名称</label>
                        <div class="layui-input-inline">
                            <input type="text" class="layui-input" name="MlPartName"
                                   placeholder="请输入测量光幕名称"/>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label" style="width: 180px">安全光幕编码</label>
                        <div class="layui-input-inline">
                            <input type="text" class="layui-input" name="SlPartNumber"
                                   placeholder="请输入安全光幕编码"/>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label" style="width: 180px">安全光幕名称</label>
                        <div class="layui-input-inline">
                            <input type="text" class="layui-input" name="SlPartName"
                                   placeholder="请输入安全光幕名称"/>
                        </div>
                    </div>
                    <div class="layui-form-item layui-hide">
                        <input type="button" lay-submit lay-filter="save-submit" id="save-submit" value="确认">
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<div th:replace="common/script::footer"></div>
<script th:inline="javascript">
    layui.config({
        base: '/static/layuiadmin/' //静态资源所在路径
    }).extend({
        index: 'lib/index', //主入口模块
    }).use(['index', 'form','crud','upload'], function(){
        let $ = layui.$,
            form = layui.form,
            crud = layui.crud,
            upload = layui.upload;
        // 编辑器
        //crud.initEditor('adContent');
        form.on('submit(save-submit)', function(data) {
            $.ajax({
                type: 'POST',
                url:  ctx + '/app/notice/add',
                data: JSON.stringify(data.field),
                contentType:'application/json;charset=UTF-8',
                dataType: 'json',
                success: function(result) {
                    layer.msg(result.message);
                    if (result.code === 200) {
                        let index = parent.layer.getFrameIndex(window.name);
                        // 关闭
                        parent.layer.close(index);
                        // 刷新
                        parent.location.reload();
                    }
                }
            });
        });
        //普通图片上传
        crud.uploadImg("picture");
    });
</script>
</body>
</html>